﻿
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>Index</title>
    <script type="text/javascript" src="~/Script/jquery.js"></script>
    <style>
        .RED {
            color: rosybrown;
        }
        .hidden {
            display: none;
        }
    </style>
    
</head>
<body>
    <div>
        <fieldset>
            <legend>
                注册
            </legend>
            <form>
                <p><input type="text" placeholder="用户名" id="name" /><span class="RED hidden" id="nameTip" onbulr="">用户名不能为空</span></p>
                <p><input type="password" placeholder="密码" id="pwd" /><span class="RED hidden" id="pwdTip">密码不能为空</span></p>
                <p><input type="password" placeholder="确认密码" id="pwd_yz" /><span class="RED hidden" id="pwdyzTip">密码不能为空</span><span class="RED hidden" id="pwdyzTip2">两次密码不一致</span></p>
                <button type="submit" onclick="Index" >提交</button>
            </form>
        </fieldset>
        <script>
          



            function Index() {
                var name = $("#name").val();
                var pwd = $("#pwd").val();
                var pwdyz = $("#pwd_yz").val();

                if (name =="") {
                    $("#nameTip").removeClass("hidden");
                    return false;

                } else {
                    $("#nameTip").addClass("hidden");

                }
                if (pwd == "") {
                    $("#pwdTip").removeClass("hidden");
                    return false;

                } else {
                    $("#pwdTip").addClass("hidden");
                }
                if (pwdyz == "") {
                    $("#pwdyzTip").removeClass("hidden");
                    return false;

                } else {
                    $("#pwdyzTip2").addClass("hidden");
                    if (pwd != pwdyz) {
                        $("#pwdyzTip2").removeClass("hidden");
                        return false;
                    }
                    else {
                        return true;
                    }

                }
                return true;

            }
            $(document).ready(function(){
                
                $("form").bind("submit", Index);
            });
        </script>
    </div>
</body>
</html>
